#pragma once

#include "Sol9Types.h"
#include <algorithm>
#include <utility>

namespace sol9
{
namespace core
{
	const f32 ROUNDING_ERROR = 0.000001f;

	template <typename T>
	__forceinline bool equals(const T& a, const T& b, const T& tolerance = (T)ROUNDING_ERROR)
	{
		return (a + tolerance >= b) && (a - tolerance <= b);
	}

	template <typename T>
	__forceinline bool isZero(const T& value, const T& tolerance = (T)ROUNDING_ERROR)
	{
		return equals(value, (T)0, tolerance);
	}

	__forceinline bool toggle(bool b)
	{
		return b = !b;
	}

} // namespace core
} // namespace sol9